hive函数

您所在的位置:网站首页 hive 替换多个字符 hive函数

hive函数

2024-06-19 09:14| 来源: 网络整理| 查看: 265

数据仓库中有的字段不合格,有特殊字符,比如换行符。

poi_name \n19013 \n12013

regexp_replace(string INITIAL_STRING, string PATTERN, string REPLACEMENT) Returns the string resulting from replacing all substrings in INITIAL_STRING that match the java regular expression syntax defined in PATTERN with instances of REPLACEMENT. For example, regexp_replace(“foobar”, “oo|ar”, “”) returns ‘fb.’ Note that some care is necessary in using predefined character classes: using ‘\s’ as the second argument will match the letter s; ‘\s’ is necessary to match whitespace, etc.

官网说用两个反斜杠代替一个,即一个反斜杠用来转义。

实践了一下,不行,得4个

select regexp_replace(poi_name,'\\\\n','') poi_name 19013 12013

转载自:https://www.cnblogs.com/woshimrf/p/hive-string-regexp-replace-usage.html



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3